1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.gstring; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import derelict.glib.gunicode; 34 import derelict.glib.garray; 35 import std.c.stdarg; 36 37 import core.stdc.string; 38 import core.stdc.config; 39 40 extern (C): 41 42 alias _GString GString; 43 44 struct _GString 45 { 46 gchar* str; 47 gsize len; 48 gsize allocated_len; 49 } 50 51 52 version(Derelict_Link_Static) 53 { 54 extern( C ) nothrow 55 { 56 GString* g_string_new(const(gchar)* init); 57 GString* g_string_new_len(const(gchar)* init, gssize len); 58 GString* g_string_sized_new(gsize dfl_size); 59 GBytes* g_string_free_to_bytes(GString *string); 60 gchar* g_string_free(GString* string, gboolean free_segment); 61 gboolean g_string_equal(const(GString)* v, const(GString)* v2); 62 guint g_string_hash(const(GString)* str); 63 GString* g_string_assign(GString* string, const(gchar)* rval); 64 GString* g_string_truncate(GString* string, gsize len); 65 GString* g_string_set_size(GString* string, gsize len); 66 GString* g_string_insert_len(GString* string, gssize pos, const(gchar)* val, gssize len); 67 GString* g_string_append(GString* string, const(gchar)* val); 68 GString* g_string_append_len(GString* string, const(gchar)* val, gssize len); 69 GString* g_string_append_c(GString* string, gchar c); 70 GString* g_string_append_unichar(GString* string, gunichar wc); 71 GString* g_string_prepend(GString* string, const(gchar)* val); 72 GString* g_string_prepend_c(GString* string, gchar c); 73 GString* g_string_prepend_unichar(GString* string, gunichar wc); 74 GString* g_string_prepend_len(GString* string, const(gchar)* val, gssize len); 75 GString* g_string_insert(GString* string, gssize pos, const(gchar)* val); 76 GString* g_string_insert_c(GString* string, gssize pos, gchar c); 77 GString* g_string_insert_unichar(GString* string, gssize pos, gunichar wc); 78 GString* g_string_overwrite(GString* string, gsize pos, const(gchar)* val); 79 GString* g_string_overwrite_len(GString* string, gsize pos, const(gchar)* val, gssize len); 80 GString* g_string_erase(GString* string, gssize pos, gssize len); 81 GString* g_string_ascii_down(GString* string); 82 GString* g_string_ascii_up(GString* string); 83 void g_string_vprintf(GString* string, const(gchar)* format, va_list args); 84 void g_string_printf(GString* string, const(gchar)* format, ...); 85 void g_string_append_vprintf(GString* string, const(gchar)* format, va_list args); 86 void g_string_append_printf(GString* string, const(gchar)* format, ...); 87 GString* g_string_append_uri_escaped(GString* string, const(gchar)* unescaped, const(gchar)* reserved_chars_allowed, gboolean allow_utf8); 88 GString* g_string_append_c_inline(GString* gstring, gchar c); 89 GString* g_string_down(GString* string); 90 GString* g_string_up(GString* string); 91 } 92 } 93 else 94 { 95 extern( C ) nothrow 96 { 97 alias da_g_string_new = GString* function(const(gchar)* init); 98 alias da_g_string_new_len = GString* function(const(gchar)* init, gssize len); 99 alias da_g_string_sized_new = GString* function(gsize dfl_size); 100 alias da_g_string_free_to_bytes = GBytes* function(GString *string); 101 alias da_g_string_free = gchar* function(GString* string, gboolean free_segment); 102 alias da_g_string_equal = gboolean function(const(GString)* v, const(GString)* v2); 103 alias da_g_string_hash = guint function(const(GString)* str); 104 alias da_g_string_assign = GString* function(GString* string, const(gchar)* rval); 105 alias da_g_string_truncate = GString* function(GString* string, gsize len); 106 alias da_g_string_set_size = GString* function(GString* string, gsize len); 107 alias da_g_string_insert_len = GString* function(GString* string, gssize pos, const(gchar)* val, gssize len); 108 alias da_g_string_append = GString* function(GString* string, const(gchar)* val); 109 alias da_g_string_append_len = GString* function(GString* string, const(gchar)* val, gssize len); 110 alias da_g_string_append_c = GString* function(GString* string, gchar c); 111 alias da_g_string_append_unichar = GString* function(GString* string, gunichar wc); 112 alias da_g_string_prepend = GString* function(GString* string, const(gchar)* val); 113 alias da_g_string_prepend_c = GString* function(GString* string, gchar c); 114 alias da_g_string_prepend_unichar = GString* function(GString* string, gunichar wc); 115 alias da_g_string_prepend_len = GString* function(GString* string, const(gchar)* val, gssize len); 116 alias da_g_string_insert = GString* function(GString* string, gssize pos, const(gchar)* val); 117 alias da_g_string_insert_c = GString* function(GString* string, gssize pos, gchar c); 118 alias da_g_string_insert_unichar = GString* function(GString* string, gssize pos, gunichar wc); 119 alias da_g_string_overwrite = GString* function(GString* string, gsize pos, const(gchar)* val); 120 alias da_g_string_overwrite_len = GString* function(GString* string, gsize pos, const(gchar)* val, gssize len); 121 alias da_g_string_erase = GString* function(GString* string, gssize pos, gssize len); 122 alias da_g_string_ascii_down = GString* function(GString* string); 123 alias da_g_string_ascii_up = GString* function(GString* string); 124 alias da_g_string_vprintf = void function(GString* string, const(gchar)* format, va_list args); 125 alias da_g_string_printf = void function(GString* string, const(gchar)* format, ...); 126 alias da_g_string_append_vprintf = void function(GString* string, const(gchar)* format, va_list args); 127 alias da_g_string_append_printf = void function(GString* string, const(gchar)* format, ...); 128 alias da_g_string_append_uri_escaped = GString* function(GString* string, const(gchar)* unescaped, const(gchar)* reserved_chars_allowed, gboolean allow_utf8); 129 alias da_g_string_append_c_inline = GString* function(GString* gstring, gchar c); 130 alias da_g_string_down = GString* function(GString* string); 131 alias da_g_string_up = GString* function(GString* string); 132 } 133 134 __gshared 135 { 136 da_g_string_new g_string_new; 137 da_g_string_new_len g_string_new_len; 138 da_g_string_sized_new g_string_sized_new; 139 da_g_string_free g_string_free; 140 da_g_string_free_to_bytes g_string_free_to_bytes; 141 da_g_string_equal g_string_equal; 142 da_g_string_hash g_string_hash; 143 da_g_string_assign g_string_assign; 144 da_g_string_truncate g_string_truncate; 145 da_g_string_set_size g_string_set_size; 146 da_g_string_insert_len g_string_insert_len; 147 da_g_string_append g_string_append; 148 da_g_string_append_len g_string_append_len; 149 da_g_string_append_c g_string_append_c; 150 da_g_string_append_unichar g_string_append_unichar; 151 da_g_string_prepend g_string_prepend; 152 da_g_string_prepend_c g_string_prepend_c; 153 da_g_string_prepend_unichar g_string_prepend_unichar; 154 da_g_string_prepend_len g_string_prepend_len; 155 da_g_string_insert g_string_insert; 156 da_g_string_insert_c g_string_insert_c; 157 da_g_string_insert_unichar g_string_insert_unichar; 158 da_g_string_overwrite g_string_overwrite; 159 da_g_string_overwrite_len g_string_overwrite_len; 160 da_g_string_erase g_string_erase; 161 da_g_string_ascii_down g_string_ascii_down; 162 da_g_string_ascii_up g_string_ascii_up; 163 da_g_string_vprintf g_string_vprintf; 164 da_g_string_printf g_string_printf; 165 da_g_string_append_vprintf g_string_append_vprintf; 166 da_g_string_append_printf g_string_append_printf; 167 da_g_string_append_uri_escaped g_string_append_uri_escaped; 168 da_g_string_append_c_inline g_string_append_c_inline; 169 da_g_string_down g_string_down; 170 da_g_string_up g_string_up; 171 } 172 }